from time import sleep

from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

from service.login import Login
from util.Util import BoxDriver,BasePage

class Addcompany(BasePage):

    def dingwei(self):
        self.driver.click(By.XPATH, '//*[@id="s-menu-superadmin"]/button')
        self.driver.switch_to_frame(By.ID, "iframe-superadmin")
    def addcomany(self):
        self.dingwei()
        # 添加成员
        self.driver.click(By.LINK_TEXT, '公司信息')
        self.driver.clear(By.ID, "name")
        self.driver.input(By.ID, "name","2林数据")
        self.driver.switch_to_frame(By.XPATH,'//*[@id="ajaxForm"]/table/tbody/tr[2]/td/div/div[2]/iframe')
        self.driver.clear(By.XPATH, "/html/body")
        self.driver.input(By.XPATH, "/html/body","测试框架1。。。。。。")

        self.driver.switch_to_parent_frame()
        self.driver.click(By.ID, "submit")

if __name__ == '__main__':
    driver = BoxDriver('Chrome')
    Login(driver).login('admin', '123456')
    Addcompany(driver).addcomany()
